package com.lz.football.module.playerCenter
{
	import com.common.utils.DisplayObjectUtil;
	import com.common.utils.Reflection;
	import com.liangzhong.constants.ClubConst;
	import com.liangzhong.model.playerCenter.vo.PlayerVo;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	import lz.controls.tips.ITip;

	/**
	 * 球员卡Tips 
	 * 球员中心的球员使用 
	 * @author Administrator
	 * 
	 */	
	public class PlayerCardTipsByPlayer extends Sprite implements ITip
	{
		/**
		 *静态全局公用 
		 */		
		private  var symbolSkin		:MovieClip;//皮肤
		public function PlayerCardTipsByPlayer()
		{
			super();
		}
		
		public function get data():Object
		{
			return null;
		}
		
		public function set data(value:Object):void
		{
			if(symbolSkin == null)
			{
				symbolSkin = Reflection.createInstance("com.lz.modul.playerCenter.card");
			}
			this.addChild(symbolSkin);
			var star :PlayerVo = value as PlayerVo;
			if(star == null)
			{
				return;
			}
			symbolSkin.playerName.text = star.starVo.name + "";
			symbolSkin.des1.text = "";
			symbolSkin.des2.text = "";
			symbolSkin.des3.text = "";
			symbolSkin.Lv.text = star.level + "";
			symbolSkin.attack.text = star.attack + ""
			symbolSkin.speed.text = star.speed + "";
			symbolSkin.steal.text = star.steal + "";
			symbolSkin.ability.text = star.ability +"";
			symbolSkin.control.text = star.control + "";
			symbolSkin.strength.text = star.power + "";
			symbolSkin.power.text = star.physical +"/"+ star.maxphysical;
			symbolSkin.salary.text = star.salary + "";
//			symbolSkin.playerCard.addChild();
//			symbolSkin.equipContain.addChild();
			if(star.status == 2)
			{
				symbolSkin.buffBtn.visible = true;
			}
			else
			{
				symbolSkin.buffBtn.visible = false;
			}
			symbolSkin.progressbar.progressbar.width = star.physical / star.maxphysical * 77;
			var card:MovieClip =  Reflection.createInstance("com.liangzhong.ui.playCard");
			symbolSkin.playerCard.addChild(card)
			card.gotoAndStop(star.color);
			card.mc.txtLv.text 			= "" + star.level;
			card.mc.txtName.text 			= "" + star.starVo.name;
			
			card.mc.ability.text 			= "" + star.ability;
			
			card.mc.txtattack.text 		= "" + star.attack;
			card.mc.txtdefence.text 		= "" + star.defence;
			card.mc.txtsteal.text 		= "" + star.steal;
			card.mc.txtpower.text 		= "" + star.power;
			card.mc.txtspeed.text 		= "" + star.speed;
			card.mc.txtcontrol.text 		= "" + star.control;
			var frameIndex :int = 1;
			var maxValue   :int = ClubConst.colorToPro(star.color);
			frameIndex = star.attack / maxValue * 11;
			card.mc.attackProMc.gotoAndStop(frameIndex);
			frameIndex = star.defence / maxValue * 11;
			card.mc.defenceProMc.gotoAndStop(frameIndex);
			frameIndex = star.steal / maxValue * 11;
			card.mc.stealProMc.gotoAndStop(frameIndex);
			frameIndex = star.power / maxValue * 11;
			card.mc.powerProMc.gotoAndStop(frameIndex);
			frameIndex = star.speed / maxValue * 11;
			card.mc.speedProMc.gotoAndStop(frameIndex);
			frameIndex = star.control / maxValue * 11;
			card.mc.controlProMc.gotoAndStop(frameIndex);
			card.mc.txtPlace.text = "" + star.starVo.placeName;
//			this.mouseChildren = false;
//			this.mouseEnabled = false;
			//大头像
			var bigImgBg :MovieClip = symbolSkin.mc.bigImgBg;
			var bigBData :BitmapData = star.starVo.bigBitmapData;
			var bigBitMap :Bitmap = new Bitmap(bigBData);
			DisplayObjectUtil.removeAllChildren(bigImgBg);
			if(bigImgBg)
			{
				bigImgBg.addChild(bigBitMap);
			}
		}
		
		public function destroy():void
		{
		}
	}
}